package com.njtoyo.taxi.admin.rest.controller.business.driver;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njtoyo.taxi.admin.aop.PermissionScope;
import com.njtoyo.taxi.admin.rest.presenter.business.driver.DriverAuditInformationPresenter;
import com.njtoyo.taxi.admin.rest.wrapper.business.driver.DriverAuditInformationQueryWrapper;
import com.njtoyo.taxi.admin.service.business.driver.DriverAuditInformationService;
import com.taxi.entity.common.RestResult;
import com.njtoyo.taxi.entity.backend.AdminUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("business/driver/audit-information")
@Api(tags = {"司机审核信息"})
public class DriverAuditInformationController {
    @Autowired
    private DriverAuditInformationService driverAuditInformationService;

    @GetMapping()
    @ApiOperation(value = "司机信息审核列表", notes = "司机信息审核列表，权限：driver_audit_list")
    @PermissionScope(names = {"driver_audit_list"})
    RestResult<Page<DriverAuditInformationPresenter>> auditList(@ModelAttribute("admin") AdminUser adminUser,
                                                                @Valid DriverAuditInformationQueryWrapper wrapper) {
        return driverAuditInformationService.getList(adminUser, wrapper);
    }

    @PatchMapping("/{id}")
    @ApiOperation(value = "司机信息审核", notes = "司机信息审核，权限：driver_review")
    @PermissionScope(names = {"driver_review"})
    RestResult review(@PathVariable("id") Long id) {
        return driverAuditInformationService.review(id);
    }

}
